Skip to content

The session history check of whether a browsing context is script-closable is not testable #51933

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
vinhill opened this issue Apr 10, 2025 · 0 comments

Comments

@vinhill
Copy link
Contributor

vinhill commented Apr 10, 2025

https://html.spec.whatwg.org/#script-closable

A navigable is script-closable if its active browsing context is an auxiliary browsing context that was created by a script (as opposed to by an action of the user), or if it is a top-level traversable whose session history entries's size is 1.

According to whatwg/html#1866, browsers don't track whether a browsing context is created by script. Rather, they allow windows created by window.open, link navigation, or form submission to be script-closable.

I'm working on updating the spec to reflect this through a is opened by web content flag.

Afaik, WPT isn't able to create a window that is not created by web content. WebDriver specifies https://w3c.github.io/webdriver/#new-window that could be suitable. But given it invokes the window-open-steps, it would likely have to clear this is opened by web content flag.

I imagine a test should open a new window that has is opened by web content set to false. Then navigate it a few times such that the session history length is larger than one, and assert it cannot be closed from script. To still close the window anyway, testdriver would also have to implement https://w3c.github.io/webdriver/#close-window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants
@vinhill and others